package com.ahau.springcloud.controller;

import com.ahau.springcloud.entities.CommonResult;
import com.ahau.springcloud.entity.PayMent;
import com.ahau.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author xiao hu die
 * @Date 2021/12/18 18:26
 * @Version 1.0
 */
@RestController

@Slf4j
public class OrderFeignController
{
    @Resource
    private PaymentFeignService paymentFeignService;
    @GetMapping("/consumer/payMent/selectOne/{id}")
    public CommonResult getPaymentById(@PathVariable("id") Long id)
    {
        log.info("进入方法了");
        return paymentFeignService.selectOne(id);
    }
    @GetMapping("/test/{id}")
    public String consumer(String id){
        String a = id;
        if (a.equals("1")){
            return "这不是1";
        } else {
            return "这是1";
        }
    }
    @GetMapping("/test2")
    public String test2(){
        return "aaa";
    }
    /**测试耗时的方法*/
    @GetMapping(value = "/consumer/payment/fegin/timeout")
    public String PaymentFeginTimeout(){
        /**openfegin默认的等待时间是1秒钟*/
        return paymentFeignService.PaymentFeginTimeout();
    }
}
